﻿using Microsoft.EntityFrameworkCore;
using Project.Frame.Net.Application.Models.Entity;
using Project.Frame.Net.Application.Repository;
using Project.Frame.Net.Infra.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Frame.Net.Infra.Repository
{
    public class UserRepository : Repository<UserModel>, IUserRepository
    {
        public UserRepository(AppDbContext context) : base(context)
        {
        }
        /// <summary>
        /// 根据用户邮箱获取用户信息
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public async Task<UserModel?> GetUserByUserIEmail(string email)
        {
            var result=await _context.UserModels.FirstOrDefaultAsync(x => x.Email == email);
            if (result == null)
            {
                return null;
            }
            return result;
        }
    }
}
